<?php
Class Site
{
	private $skey = '';
	private $path = '';
	public $jsdata = '';
	
	public function run()
	{
		$this->skey = isset($_GET['k']) ? Unit::safe($_GET['k']) : 'index';
		$this->path = DATA_DIR . 'site' . DS;
		$file = $this->path . $this->skey . '.php';
		if (file_exists($file)) {
			include_once $file;
		}
	}
	
	public function load($filename)
	{
		$res = '';
		if (is_array($filename)) {
			foreach ($filename as $type => $ary) {
				if ($type == 'css') {
					foreach ($ary as $item) {
						$res .= '<link rel="stylesheet" type="text/css" href="' . $this->path . $item . '"\n';
					}
				} elseif ($type == 'js') {
					foreach ($ary as $item) {
						$res .= '<script type="text/javascript" src="' . $this->path . $item . '"></script>';
					}
				}
			}
		}
		return $res;
		
	}
	
	
}